<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>事件监听函数</title>
    <style type="text/css" media="screen">
    body {
        width: 960px;
        margin: 0 auto;
        font: 18px/1.8em '微软雅黑';
    }

    p {
        font-size: 20;
        padding: 5px 0;
        font-weight: bolder;
    }
    </style>
    <script>
    window.onload = function() {
        //获取具体的对象
        var oP = document.getElementById('myP');
        // 设置事件监听函数
        oP.onclick = function() {
            alert('我被点击了。');
        }
    }
    </script>
</head>

<body>
    <div>
        <p id="myP">请先点击我，再点击下一个。</p>
    </div>
    <a href="1102.html" target="_blank">下一个</a>
</body>

</html>
